package com.sayimo.maker.user.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sayimo.framework.database.mybatis.AbstractMybatisBaseDao;
import com.sayimo.framework.exception.DaoException;
import com.sayimo.maker.user.dao.MemberCustomerInterfaceDao;
import com.sayimo.maker.user.vo.MemberCustomer;


/**
 * @Project: sayimoWeixinApi
 * @ClassName: MemberCustomerInterfaceImplDao
 * @Description: 会员Dao
 * @Author: 王瑞清
 * @Date: 日期：2015年9月11日 时间：下午6:51:24
 * @Version 1.0.0
 */
@Repository("memberCustomerInterfaceDao")
public class MemberCustomerInterfaceImplDao extends AbstractMybatisBaseDao<MemberCustomer>
		implements MemberCustomerInterfaceDao {

	public int insertMemberCustomerOpenId(MemberCustomer customer) throws DaoException {
		return this.mybatisInterfaceBaseDao.insert(
				"com.sayimo.maker.user.dao.MemberCustomerInterfaceDao.insertMemberCustomerOpenId",
				customer);
	}

	public Object queryMemberCustomerParentId(String openId) throws DaoException {
		return this.mybatisInterfaceBaseDao.getObject(
				"com.sayimo.maker.user.dao.MemberCustomerInterfaceDao.queryMemberCustomerParentId",
				openId);
	}

	public int queryMemberCustomereByAccout(String account) throws DaoException {
		return (int) this.mybatisInterfaceBaseDao.getObject(
				"com.sayimo.maker.user.dao.MemberCustomerInterfaceDao.queryMemberCustomereByAccout",
				account);
	}

	public Object queryMemberCustomerByParentId(Integer parentId) throws DaoException {
		return this.mybatisInterfaceBaseDao.getObject(
				"com.sayimo.maker.user.dao.MemberCustomerInterfaceDao.queryMemberCustomerByParentId",
				parentId);
	}

	@Override
	public MemberCustomer queryMemberCustomerByOpenId(String openId) throws DaoException {
		return this.mybatisInterfaceBaseDao.get(
				"com.sayimo.maker.user.dao.MemberCustomerInterfaceDao.queryMemberCustomerByOpenId",
				openId);
	}
	
	/**
	 * 
	* @Title: updateUserInfo 
	* @Author: 田超
	* @Date:日期：2016年7月21日  时间：下午3:16:01
	* @Description: 根据openId更新用户信息
	* @param openId
	* @return
	* @throws DaoException
	* @return Integer
	* @Version 1.0.0
	 */
	@Override
	public Integer updateUserInfo(MemberCustomer customer) throws DaoException {
		return this.mybatisInterfaceBaseDao.update("com.sayimo.maker.user.dao.MemberCustomerInterfaceDao.updateUserInfo",customer);
	}
	
	/**
	 * 
	* @Title: queryMemebrInfo 
	* @Author: 田超
	* @Date:日期：2016年7月22日  时间：下午2:43:46
	* @Description: 查询所有的用户
	* @return
	* @throws DaoException
	* @return List<MemberCustomer>
	* @Version 1.0.0
	 */
	@Override
	public List<MemberCustomer> queryMemebrInfo() throws DaoException {
		
		return this.mybatisInterfaceBaseDao.query("com.sayimo.maker.user.dao.MemberCustomerInterfaceDao.queryMemebrInfo");
	}

	@Override
	public Map queryOpenId(Integer id) throws DaoException {
		return this.mybatisInterfaceBaseDao.queryMap("com.sayimo.maker.user.dao.MemberCustomerInterfaceDao.queryOpenId","openId",id);
	}
}
